package com.zfx.service.impl;

import com.github.pagehelper.PageHelper;
import com.zfx.mapper.IUserMapper;
import com.zfx.pojo.User;
import com.zfx.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @description:
 * @author: zfx
 * @version: 1.0
 * @time: 2020-05-08 0:53
 * <p>
 * 修改历史：
 * 修改日期      修改人员    版本    内容
 * 2020-05-08   zfx       1.0
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserMapper userMapper;

    @Transactional(readOnly = true)
    @Override
    public List<User> findByUser(User user, int page, int size) {
        PageHelper.startPage(page, size);
        return userMapper.findByUser(user);
    }

    @Transactional(readOnly = true)
    @Override
    public int countByUser(User user) {
        return userMapper.countByUser(user);
    }
}
